#include <bits/stdc++.h>
using namespace std;

int main_110()
{
    srand((unsigned int)time(nullptr));
    int n=20,m=20,M=14;
    int arr[n]={0};
    for (int i=0;i<n ;++i )
    {
        arr[i]=rand()%20;
    }
    sort(arr,arr+n);
    for (int i=0;i<n ;++i )
    {
        printf("%d ",arr[i]);
    }
    putchar('\n');
    int i=0,j=n-1;
    while (i<j)
    {
        if (arr[i]+arr[j]==M)
        {
            printf("%d %d\n",arr[i],arr[j]);
            ++i;
            --j;
        }
        else if (arr[i]+arr[j]<M)
        {
            ++i;
        }
        else
        {
            --j;
        }
    }
	return 0;
}
